<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">

    <title> - 登录</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="css/animate.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">
    <link href="css/login.css" rel="stylesheet">
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->
    <script>
        if (window.top !== window.self) {
            window.top.location = window.location;
        };
    </script>
	<script src="js/jquery.min.js?v=2.1.4"></script>
	<script type="text/javascript">
		function login_test(){
//			var form = new FormData();
//  				form.append("username",$("#username").val());
//  				form.append("password",$("#password").val());
//				form.append("filed1",$("#filed1").val());
			 if($("#username").val().replace(/(^\s*)|(\s*$)/g, '')===''){
					alert("用户名不能为空");
				 	return false;
				}
			 if($("#pwd").val().replace(/(^\s*)|(\s*$)/g, '')===''){
					alert("密码不能为空");
				 	return false;
				}
			var form=
				{
				username:$("#username").val(),
				password:$("#pwd").val()
				};
			 console.log(form);
		
　			$.ajax({
                url:"http://localhost:8081/lecture/login",
                type:"post",
				contentType: "application/json;charset=UTF-8",
                data:JSON.stringify(form),
				dataType: "json",
                success:function(data){
					console.log(data);
                  if(data===0){
					 window.location.href="index.html";
					}else{
						alert("用户名或密码错误"); 
					}
                }
			});
		};
	</script>

</head>

<body class="signin">
    <div class="signinpanel">
        <div class="row">
            <div class="col-sm-12">
                    <h4 class="no-margins">登录：</h4>
                    <p class="m-t-md">潮品店库存数据服务平台</p>
                    <input id="username" type="text" class="form-control uname" placeholder="用户名" />
                    <input id="pwd" type="password" class="form-control pword m-b" placeholder="密码" />
                    <a href="register.html">注册账户</a>
                    <button onclick="return login_test();" class="btn btn-success btn-block">登录</button>
            </div>
        </div>
        <div class="signup-footer">
            <div class="pull-left">
                &copy; JHR
            </div>
        </div>
    </div>
</body>

</html>
